import { combineReducers } from 'redux'
import { count } from './count'
import { city } from './city'
import { word } from './word'
import { flag } from './flag'
import { msg } from './msg'
import { data } from './data'

export const reducers = combineReducers({
  count,
  city,
  word,
  flag,
  msg,
  data
})


// const defaultState = {
//   count: 100,
//   city: '武汉',
//   word: '我们这么久没见',
//   flag: true,
//   msg: '拦路雨偏似雪花',
// }

// export const reducers = (state = defaultState, action) => {
//   const { type, payload } = action

//   switch (type) {
//     case "countAdd":
//       state.count++
//       console.log(state);
//       return state
//       break;

//     case "countDesc":
//       state.count -= payload
//       return state
//       break;

//     case "changeCount":
//       return { ...state, count: state.count + payload }
//       break;

//     case "changeCity":
//       return Object.assign(state, { city: payload })
//       break;

//     case "changeWord":
//       return Object.assign(state, { word: payload })
//       break;

//     case "changeFlag":
//       return Object.assign(state, { flag: payload })
//       break;

//     case "changeMsg":
//       return Object.assign(state, { msg: payload })
//       break;

//     case "changeDataTestAsync":
//       return Object.assign(state, { test: payload })
//       break;
//     default:
//       return state
//       break;
//   }
// }
